/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    overflow-x: hidden;
}

/* Main container with responsive height */
.lab-container {
    width: 100%;
    height: 450px; /* Default iframe height */
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
}

/* Detect if not in iframe for full screen */
@media (min-height: 600px) {
    .lab-container:not(.iframe-mode) {
        height: 90vh;
    }
}

/* Lab bench layout */
.lab-bench {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.reagents-section, .samples-section {
    flex: 1;
    min-width: 250px;
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 2px solid #e1e8ed;
}

.section-title {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 14px;
    cursor: help;
}

/* Reagent and sample racks */
.reagent-rack, .sample-rack {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: space-around;
}

.reagent-bottle, .sample-tube {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    min-width: 60px;
    text-align: center;
}

.reagent-bottle:hover, .sample-tube:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.reagent-bottle.selected, .sample-tube.selected {
    background: #e3f2fd;
    border: 2px solid #2196f3;
}

/* Bottle and tube styles */
.bottle, .tube {
    width: 35px;
    height: 50px;
    border-radius: 4px 4px 15px 15px;
    margin-bottom: 5px;
    border: 2px solid #666;
    position: relative;
}

.bottle::before, .tube::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 8px;
    background: #666;
    border-radius: 2px 2px 0 0;
}

/* Reagent colors - removed water-bottle styles */
.iodine-bottle { background: linear-gradient(to bottom, #8B4513, #A0522D); }
.benedict-bottle { background: linear-gradient(to bottom, #1E90FF, #4169E1); }
.biuret-bottle { background: linear-gradient(to bottom, #0066CC, #003D7A); }
.ethanol-bottle { background: linear-gradient(to bottom, #F0F0F0, #E0E0E0); }

/* Sample colors */
.starch-sample { background: linear-gradient(to bottom, #FFF8DC, #F5DEB3); }
.glucose-sample { background: linear-gradient(to bottom, #FFFFE0, #F0E68C); }
.protein-sample { background: linear-gradient(to bottom, #F5F5DC, #DDD); }
.oil-sample { background: linear-gradient(to bottom, #FFD700, #FFA500); }
.unknown-sample { background: linear-gradient(to bottom, #D3D3D3, #A9A9A9); }

.reagent-bottle span, .sample-tube span {
    font-size: 11px;
    font-weight: 500;
    color: #2c3e50;
}

/* Testing area */
.testing-area {
    display: flex;
    gap: 15px;
    flex: 1;
    min-height: 200px;
}

.test-workspace, .results-panel {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 2px solid #e1e8ed;
}

/* Test tube container */
.test-tube-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 15px 0;
}

.test-tube {
    width: 60px;
    height: 120px;
    background: linear-gradient(to bottom, transparent 0%, #f0f0f0 95%);
    border: 3px solid #666;
    border-radius: 0 0 25px 25px;
    position: relative;
    overflow: hidden;
}

.tube-content {
    position: absolute;
    bottom: 0;
    width: 100%;
    transition: all 0.8s ease;
    border-radius: 0 0 22px 22px;
}

.tube-label {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #555;
}

/* Action buttons */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.action-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: #3498db;
    color: white;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 70px;
    height: auto;
    white-space: nowrap;
}

.action-btn:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.action-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

.reset-btn {
    background: #e74c3c !important;
}

.reset-btn:hover {
    background: #c0392b !important;
}

/* Results panel */
.result-display {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-text {
    font-size: 14px;
    color: #495057;
    text-align: center;
    line-height: 1.4;
}

.conclusion {
    background: #e8f5e8;
    border: 2px solid #28a745;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #155724;
    display: none;
}

/* Instructions panel */
.instructions-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 100;
}

.instructions-panel {
    position: absolute;
    top: 50px;
    right: 10px;
    width: 300px;
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    border: 2px solid #3498db;
    display: none;
    z-index: 99;
    max-height: 300px;
    overflow-y: auto;
}

.instructions-panel h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 16px;
}

.test-info {
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.4;
    color: #555;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 200px;
    text-align: center;
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    .lab-container {
        padding: 8px;
        gap: 10px;
    }
    
    .lab-bench {
        flex-direction: column;
    }
    
    .testing-area {
        flex-direction: column;
    }
    
    .reagent-rack, .sample-rack {
        gap: 6px;
    }
    
    .bottle, .tube {
        width: 30px;
        height: 40px;
    }
    
    .action-buttons {
        gap: 6px;
    }
    
    .action-btn {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 60px;
    }
    
    .instructions-panel {
        width: 250px;
        right: 5px;
    }
}

/* Animation classes for reactions */
.heating {
    animation: bubble 1s infinite;
}

@keyframes bubble {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.shaking {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* Result color classes */
.positive-starch { background: linear-gradient(to top, #1a1a2e, #16213e) !important; }
.positive-sugar-low { background: linear-gradient(to top, #2d5016, #4a7c59) !important; }
.positive-sugar-med { background: linear-gradient(to top, #cc8400, #ff9500) !important; }
.positive-sugar-high { background: linear-gradient(to top, #8b0000, #dc143c) !important; }
.positive-protein { background: linear-gradient(to top, #4a148c, #7b1fa2) !important; }
.positive-fat { background: linear-gradient(to top, #f5f5f5, #ffffff) !important; opacity: 0.9; }
.negative-result { background: linear-gradient(to top, #e3f2fd, #bbdefb) !important; }